import request from '@/utils/request'
import {newRequest} from '@/utils/newRequest'

export function getRoutes() {
  return request({
    url: '/routes',
    method: 'get'
  })
}

export function getRoles() {
  return request({
    url: '/roles',
    method: 'get'
  })
}

export function addRole(data) {
  return request({
    url: '/role',
    method: 'post',
    data
  })
}

export function updateRole(id, data) {
  return request({
    url: `/role/${id}`,
    method: 'put',
    data
  })
}

export function deleteRole(id) {
  return request({
    url: `/role/${id}`,
    method: 'delete'
  })
}




// 初始化角色管理
export function roleManage() {
  return newRequest({
    url: '/api/account/GetRoleList',
    method: 'get',
  })
}

// 新增角色
export function changeRole(data){
  return newRequest({
    url:'/api/account/InsertRole',
    method:'post',
    data:{
      ...data
    }
  })
}

// 删除角色
export function removeRole(data){
  return newRequest({
    url:'/api/account/DeleteRole',
    method:'post',
    data:{
      ...data
    }
  })
}


// 编辑
export function redactData(data){
  return newRequest({
    url:'/api/account/UpdateRole',
    method:'post',
    data:{
      ...data
    }
  })
}